package com.example.jn_dxs.Base;

import android.util.Log;

import io.reactivex.disposables.Disposable;

public class Observer<T> implements io.reactivex.Observer<T> {

    private Disposable disposable;
    private static final String TAG = "Observer";

    @Override
    public void onSubscribe(Disposable d) {
        this.disposable = d;
    }

    @Override
    public void onNext(T t) {
        disposable.dispose();
    }

    @Override
    public void onError(Throwable e) {
        Log.e(TAG, "onError: " + e);
        disposable.dispose();
    }

    @Override
    public void onComplete() {
        disposable.dispose();
    }
}
